function removeCookie(key, ops={}){
    ops.expires = -1;
    setCookie(key,null,ops)
}

function getCookie(key){ 
    let arr = document.cookie.split("; ");
    for(let i=0;i<arr.length;i++){
        if(arr[i].split("=")[0] === key){
            return arr[i].split("=")[1];
        }
    }
    return "";
}


function setCookie(key, val, ops={}){
    let date = "";
    if(ops.expires){
        var d = new Date();
        d.setDate(d.getDate()+ops.expires);
        date = `;expires=`+d;
    }
    let path = ops.path ? `;path=${ops.path}` : "";
    document.cookie = `${key}=${val}${path}${date}`;
}